package ch.ffhs.stupidtaskmanager.persistenz;

public class DatenBankHelfer {
	/**
	 * Escaped Single-Quotes in Fliesstext-Strings
	 * Quelle: www.roseindia.net
	 * 
	 * @param str Suchstring
	 * @return neuer String mit escapted Single-Quotes
	 */	
	public String addSlashes(String str){
		if(str==null){
			return "";
		}

		StringBuffer s = new StringBuffer ((String) str);
		for (int i = 0; i < s.length(); i++){
			if (s.charAt (i) == '\''){
				s.insert (i++, '\\');
			}
			
		}
		return s.toString();
	}
}
